package graph

import (
    "math/rand"
    "time"
)

func createRandomEdgeMap(numV, numE int, seed int64) *EdgeMap {
    // Just... don't do this
    if numV < 0 || numE < 0 {
        numV = 100
        numE = 200
    }

    // Not really a random graph anymore...
    if numE > ( numV * (numV-1)) {
        numE = numV * (numV-1)
    }

    g := CreateEdgeMap(numV)
    g.fillVertices() // Fills to capacity
    if seed == -1 {
        seed = time.Now().UnixNano()
    }
    rand.Seed(seed)
    for i := 0; i < numE; i++ {
        src := VertexID(rand.Int()%numV)
        dst := VertexID(rand.Int()%numV)
        if !g.AddEdge(src, dst) {
            i--
        }
    }
    return g
}

// TODO - add other types of graph creation functions?
